package indi.jp.project.base.thread;

import indi.jp.project.base.service.EmployeeService;
import indi.jp.project.core.util.ApplicationContextUtil;

import java.sql.SQLException;

public class EmployeeThread implements Runnable {

    public static boolean IS_RUNNING = false;

    @Override
    public void run() {
        IS_RUNNING = true;
        while (IS_RUNNING) {
            EmployeeService employeeService = ApplicationContextUtil.getBean("employeeServiceImpl");
            try {
                int count = employeeService.doExecute();
                if (count == 0) {
                    IS_RUNNING = false;
                }
            } catch (SQLException e) {
                e.printStackTrace();
                IS_RUNNING = false;
            }
        }
    }
}
